package com.ucode.application.form.crm;

import java.io.Serializable;
import java.util.Date;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

import com.ucode.crm.mode.Business;
import com.ucode.springboot.starter.web.validator.group.AddGroup;
import com.ucode.springboot.starter.web.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@SuppressWarnings("serial")
@ApiModel(value="商机")
public class BusinessForm implements Serializable{

    @ApiModelProperty(value = "商机状态组",required=true)
    @NotNull(message="请选择商机状态组", groups = {AddGroup.class,UpdateGroup.class})
    private Long groupId;
    
    @ApiModelProperty(value = "商机状态",required=true)
    @NotNull(message="请选择商机状态", groups = {AddGroup.class,UpdateGroup.class})
    private Long statusId;
    
    @ApiModelProperty(value = "客户",required=true)
    @NotNull(message="客户不能为空", groups = {AddGroup.class})
    private Long customerId;
    
    @ApiModelProperty(value = "商机名称",required=true)
    @NotBlank(message = "商机名称不能为空", groups = {AddGroup.class,UpdateGroup.class})
    @Length(max=100,message = "商机名称最大200个字符", groups = {AddGroup.class,UpdateGroup.class})
    private String name;
    
    @ApiModelProperty(value = "商机预计金额,单位分",required=false)
    private Integer money;
    
    @ApiModelProperty(value = "商机预计金额,单位分",required=false)
    private Integer expectAmount;
  
    @ApiModelProperty(value = "预计成交日期",required=false)
    private Date expectDealDate;
    
    @ApiModelProperty(value = "整体折扣率，单位%",required=false)
    private Integer discountRate;
    
    @ApiModelProperty(value = "产品总销售金额,单位分",required=false)
    private Integer totalPrice;
    
    @ApiModelProperty(value = "商机最终实际金额,单位分",required=false)
    private Integer actualAmount;
    
    @ApiModelProperty(value = "备注",required=false)
    @Length(max=100,message = "备注最大500个字符", groups = {AddGroup.class,UpdateGroup.class})
    private String  remark;

    @ApiModelProperty(value = "下次跟进时间",required=false)
    private Date nextTime;

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public Long getStatusId() {
        return statusId;
    }

    public void setStatusId(Long statusId) {
        this.statusId = statusId;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(Long customerId) {
        this.customerId = customerId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public Integer getExpectAmount() {
        return expectAmount;
    }

    public void setExpectAmount(Integer expectAmount) {
        this.expectAmount = expectAmount;
    }

    public Date getExpectDealDate() {
        return expectDealDate;
    }

    public void setExpectDealDate(Date expectDealDate) {
        this.expectDealDate = expectDealDate;
    }

    public Integer getDiscountRate() {
        return discountRate;
    }

    public void setDiscountRate(Integer discountRate) {
        this.discountRate = discountRate;
    }

    public Integer getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(Integer totalPrice) {
        this.totalPrice = totalPrice;
    }

    public Integer getActualAmount() {
        return actualAmount;
    }

    public void setActualAmount(Integer actualAmount) {
        this.actualAmount = actualAmount;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getNextTime() {
        return nextTime;
    }

    public void setNextTime(Date nextTime) {
        this.nextTime = nextTime;
    }
    
    public Business build(){
        Business business = new Business();
        business.setGroupId(this.groupId );
        business.setStatusId(this.statusId);
        business.setCustomerId(this.customerId);
        business.setName(this.name);
        business.setMoney(this.money);
        business.setExpectAmount(this.expectAmount);
        business.setExpectDealDate(this.expectDealDate);
        business.setDiscountRate(this.discountRate);
        business.setTotalPrice(this.totalPrice);
        business.setActualAmount(this.actualAmount);
        business.setRemark(this.remark);
        business.setNextTime(this.nextTime);
        return business;
    }
}
